﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;

namespace Pixysoft.Framework.Sockets
{
    public delegate void SocketExceptionCaught(ISocketIoSession session, Exception ex);

    public interface ISocketIoSession : ISocketIoSessionBase
    {
        event SocketExceptionCaught OnSocketExceptionCaught;


        IPerformanceAnalyzer GetPerformanceAnalyzer();


        bool IsDisposed { get;}

        bool IsTimeout { get;}

        bool IsLoginningTimeout { get;}



        IProtocolMessage CreateRequest(int protocol, int action);

        IProtocolMessage CreateResponse(IProtocolHeader header);

        void Reset(IProtocolMessage mesasge);

        void Send(IProtocolMessage message);

        void Send(IProtocolMessage[] messages);

        void Send(byte[] sendBytes);

        void SyncSend(byte[] sendBytes);

        void Close();

        void Dispose();

        /// <summary>
        /// 清除socket的内存数据 但是不释放链接
        /// </summary>
        void Clear();
    }
}
